package edu.npu.cv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import edu.npu.cv.dao.ActivityDAO;
import edu.npu.cv.dao.ArticleDAO;
import edu.npu.cv.entity.ActivityDO;
import edu.npu.cv.entity.ArticleDO;
import edu.npu.cv.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lelechang
 * @description: 服务层
 * @version: V1.0
 */
@Service
public class ActivityServiceImpl implements ActivityService {

    @Autowired
    private ActivityDAO activityDao;
    @Autowired
    private ArticleDAO articleDAO;

    /**
     * 从数据库中获取活动列表
     *
     * @return
     */
    public List<ActivityDO> findAll() {
        return activityDao.selectList(new QueryWrapper<ActivityDO>());
    }

    /**
     * 根据ID查询实体
     *
     * @param id
     * @return
     */
    public ActivityDO findById(String id) {
        return activityDao.selectById(id);
    }

    public List<ArticleDO> findActivity(){
        return articleDAO.findActivity();
    }
}
